var rows = [];

function addRow(type, name, startTime, endTime) {
	rows.push([ type, name, new Date(startTime), new Date(endTime) ]);
}

function drawChart() {
	var container = document.getElementById('chart');
	var chart = new google.visualization.Timeline(container);
	var dataTable = new google.visualization.DataTable();
	
	dataTable.addColumn({
		type : 'string',
		id : 'Type'
	});
	dataTable.addColumn({
		type : 'string',
		id : 'Name'
	});
	dataTable.addColumn({
		type : 'date',
		id : 'Start'
	});
	dataTable.addColumn({
		type : 'date',
		id : 'End'
	});

	dataTable.addRows(rows);

	var options = {
		timeline : {
			colorByRowLabel : true
		}
	};
	chart.draw(dataTable, options);
}

function handleOnLoad() {
	jsInterface.draw();
}

google.setOnLoadCallback(handleOnLoad);